gtk/window: Don't gdk_toplevel_present() if not mapped
authorJonas Ådahl <jadahl@gmail.com>
Fri, 20 Nov 2020 16:11:44 +0000 (17:11 +0100)
committerJonas Ådahl <jadahl@gmail.com>
Mon, 7 Dec 2020 08:46:39 +0000 (09:46 +0100)
That would map the window too early.

gtk/gtkwindow.c

index 996e09c64b67d51c49bcfabc2b0cfb27c83f3c4d..e1d83addbda2a9012897a9374cd8893befc38fb2 100644 (file)
@@ -3856,7 +3856,8 @@ gtk_window_update_toplevel (GtkWindow *window)
       g_clear_pointer (&priv->layout, gdk_toplevel_layout_unref);
       priv->layout = gtk_window_compute_layout (window);
 
-      gdk_toplevel_present (GDK_TOPLEVEL (priv->surface), priv->layout);
+      if (_gtk_widget_get_mapped (GTK_WIDGET (window)))
+        gdk_toplevel_present (GDK_TOPLEVEL (priv->surface), priv->layout);
     }
 }
 
@@ -5660,7 +5661,8 @@ gtk_window_move_resize (GtkWindow *window)
       if (configure_request_pos_changed)
         g_warning ("configure request position changed. This should not happen. Ignoring the position");
 
-      gdk_toplevel_present (GDK_TOPLEVEL (priv->surface), priv->layout);
+      if (_gtk_widget_get_mapped (widget))
+        gdk_toplevel_present (GDK_TOPLEVEL (priv->surface), priv->layout);
     }
   else
     {
@@ -5869,8 +5871,6 @@ gtk_window_present_with_time (GtkWindow *window,
 
       g_assert (surface != NULL);
 
-      gtk_window_present_toplevel (window);
-
       /* Translate a timestamp of GDK_CURRENT_TIME appropriately */
       if (timestamp == GDK_CURRENT_TIME)
         {